home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
menubar.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
9KB
|
199 lines
ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr((((nnnn)))) TTTTkkkk (((( )))) ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
tk_menuBar, tk_bindForTraversal - Support for menu bars
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr _f_r_a_m_e ?_m_e_n_u _m_e_n_u ...?
ttttkkkk____bbbbiiiinnnnddddFFFFoooorrrrTTTTrrrraaaavvvveeeerrrrssssaaaallll _a_r_g _a_r_g ...
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
These two commands are Tcl procedures in the Tk script
library. They provide support for menu bars. A menu bar is
a frame that contains a collection of menu buttons that work
together, so that the user can scan from one menu to another
with the mouse: if the mouse button is pressed over one
menubutton (causing it to post its menu) and the mouse is
moved over another menubutton in the same menu bar without
releasing the mouse button, then the menu of the first
menubutton is unposted and the menu of the new menubutton is
posted instead. Menus in a menu bar can also be accessed
using keyboard traversal (i.e. by typing keystrokes instead
of using the mouse). In order for an application to use
these procedures, it must do three things, which are
described in the paragraphs below.
First, each application must call ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr to provide
information about the menubar. The _f_r_a_m_e argument gives the
path name of the frame that contains all of the menu
buttons, and the _m_e_n_u arguments give path names for all of
the menu buttons associated with the menu bar. Normally
_f_r_a_m_e is the parent of each of the _m_e_n_u's. This need not be
the case, but _f_r_a_m_e must be an ancestor of each of the
_m_e_n_u's in order for grabs to work correctly when the mouse
is used to pull down menus. The order of the _m_e_n_u arguments
determines the traversal order for the menu buttons. If
ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr is called without any _m_e_n_u arguments, it returns
a list containing the current menu buttons for _f_r_a_m_e, or an
empty string if _f_r_a_m_e isn't currently set up as a menu bar.
If ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr is called with a single _m_e_n_u argument
consisting of an empty string, any menubar information for
_f_r_a_m_e is removed; from now on the menu buttons will
function independently without keyboard traversal. Only one
menu bar may be defined at a time within each top-level
window.
The second thing an application must do is to identify the
traversal characters for menu buttons and menu entries.
This is done by underlining those characters using the
----uuuunnnnddddeeeerrrrlllliiiinnnneeee options for the widgets. The menu traversal
Page 1 (printed 7/23/95)
ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr((((nnnn)))) TTTTkkkk (((( )))) ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr((((nnnn))))
system uses this information to traverse the menus under
keyboard control (see below).
The third thing that an application must do is to make sure
that the input focus is always in a window that has been
configured to support menu traversal. If the input focus is
nnnnoooonnnneeee then input characters will be discarded and no menu
traversal will be possible. If you have no other place to |
set the focus, set it to the menubar widget: ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr |
creates bindings for its _f_r_a_m_e argument to support menu |
traversal. |
The Tk startup scripts configure all the Tk widget classes |
with bindings to support menu traversal, so menu traversal |
will be possible regardless of which widget has the focus.
If your application defines new classes of widgets that
support the input focus, then you should call
ttttkkkk____bbbbiiiinnnnddddFFFFoooorrrrTTTTrrrraaaavvvveeeerrrrssssaaaallll for each of these classes.
TTTTkkkk____bbbbiiiinnnnddddFFFFoooorrrrTTTTrrrraaaavvvveeeerrrrssssaaaallll takes any number of arguments, each of
which is a widget path name or widget class name. It sets
up bindings for all the named widgets and classes so that
the menu traversal system will be invoked when appropriate
keystrokes are typed in those widgets or classes.
MMMMEEEENNNNUUUU TTTTRRRRAAAAVVVVEEEERRRRSSSSAAAALLLL BBBBIIIINNNNDDDDIIIINNNNGGGGSSSS
Once an application has made the three arrangements
described above, menu traversal will be available. At any
given time, the only menus available for traversal are those
associated with the top-level window containing the input
focus. Menu traversal is initiated by one of the following
actions:
[1] If <F10> is typed, then the first menu button in the
list for the top-level window is posted and the first
entry within that menu is selected.
[2] If <Alt-_k_e_y> is pressed, then the menu button that has
_k_e_y as its underlined character is posted and the first
entry within that menu is selected. The comparison
between _k_e_y and the underlined characters ignores case
differences. If no menu button matches _k_e_y then the
keystroke has no effect.
[3] Clicking mouse button 1 on a menu button posts that
menu and selects its first entry.
Once a menu has been posted, the input focus is switched to
that menu and the following actions are possible:
[1] Typing <ESC> or clicking mouse button 1 outside the
menu button or its menu will abort the menu traversal.
Page 2 (printed 7/23/95)
ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr((((nnnn)))) TTTTkkkk (((( )))) ttttkkkk____mmmmeeeennnnuuuuBBBBaaaarrrr((((nnnn))))
[2] If <Alt-_k_e_y> is pressed, then the entry in the posted
menu whose underlined character is _k_e_y is invoked.
This causes the menu to be unposted, the entry's action
to be taken, and the menu traversal to end. The
comparison between _k_e_y and underlined characters
ignores case differences. If no menu entry matches _k_e_y
then the keystroke is ignored.
[3] The arrow keys may be used to move among entries and
menus. The left and right arrow keys move circularly
among the available menus and the up and down arrow
keys move circularly among the entries in the current
menu.
[4] If <Return> is pressed, the selected entry in the
posted menu is invoked, which causes the menu to be
unposted, the entry's action to be taken, and the menu
traversal to end.
When a menu traversal completes, the input focus reverts to
the window that contained it when the traversal started.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
keyboard traversal, menu, menu bar, post
Page 3 (printed 7/23/95)